require(["angular","webconfig"],function(angular,webConfig){
    var app=angular.module('myApp',[])
    app.filter('trustHtml', function ($sce) {
        return function (input) {
            return $sce.trustAsHtml(input);
        }
    });
    app.controller('myCtrl',['$scope','$http',function($scope,$http){
        $scope.menuData={}
        $http({method:'get',url:webConfig.getUrl('/api/getindexmenu')})
            .then(function (data) {
                var result = [];
                for(var i=0,len=data.data.result.length;i<len;i+=4){
                    result.push(data.data.result.slice(i,i+4));
                }
                $scope.menuData=result;
            })
        $http({method:'get',url:webConfig.getUrl('/api/getmoneyctrl')})
            .then(function (data) {
                $scope.moneyCtrls=data.data.result;
            })
        $scope.menuToggle=false;
        $scope.menuRoute=function(indexmenuId,titlehref){
            if(indexmenuId==7){
                $scope.menuToggle=!$scope.menuToggle;
                return
            }
            switch (indexmenuId){
                case 7:$scope.menuToggle=!$scope.menuToggle;
                    return;
                default:location.href='pages/'+titlehref;
            }

        }
        $scope.routeToMoney=function () {
            location.href='pages/moneyctrl.html'
        }
    }])
    

})

